package com.jerry.template.module.mainpage.find.fragment;

import android.support.v4.app.Fragment;
import android.widget.RadioGroup;

import com.jerry.template.R;
import com.jerry.template.base.BaseFragment;

import butterknife.BindView;

/**
 * Created by chenhuan on 2016/5/11.
 */
public class FindFragment extends BaseFragment{

    @BindView(R.id.topbtn_group)
    RadioGroup topGroup;

    @Override
    protected int getLayoutId(){
        return R.layout.frag_faxian;
    }

    @Override
    protected void initViews(){
        getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.frame_faxian,BaseFragment.newInstance(FindDefaultFragment.class,null)).commit();

        topGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener(){
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId){
                Fragment fragment = null;
                switch(checkedId){
                    case R.id.reba:
                        fragment = BaseFragment.newInstance(FindDefaultFragment.class,null);
                        getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.frame_faxian,fragment).commit();
                        break;
                    case R.id.dingyue:
                        fragment = BaseFragment.newInstance(SubscriptionFragment.class,null);
                        getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.frame_faxian,fragment).commit();
                        break;
                    default:
                        break;
                }
            }
        });

    }

    @Override
    protected void loadData(){
    }
}
